import Vue from 'vue'
import App from './App'

// 挂载全局方法
import config from "./common/config.js"
Vue.prototype.config=config

import lib from "./common/lib.js"
Vue.prototype.lib=lib

import request from "./common/request.js";
Vue.prototype.$http = request;

import User from "./common/user.js"
Vue.prototype.User = User
	
// manifest.json中配置微信小程序appid是wx366aedeecfcd3d82
Vue.config.productionTip = false
Vue.prototype.checkLogin=function(backpage, backtype){
	console.log('SUID')
	// backpage, backtype 2个参数分别代表：
	// backpage : 登录后返回的页面
	// backtype : 打开页面的类型[1 : redirectTo 2 : switchTab]
	var NAME  = uni.getStorageSync('name');
	var NO = uni.getStorageSync('no');
	
	if(NAME == '' || NO == ''){
		uni.redirectTo({
			url: '../login/login'
		});
		return false
	}else{
		// 已经登录返回数组 [用户 id, 用户随机码, 用户昵称, 用户表情]
		return [NAME, NO];
	}
}
App.mpType = 'app'

const app = new Vue({
    ...App
})
app.$mount()
